package com.jinmdz.fmis.mapper.mapper;

import org.apache.ibatis.annotations.*;
import com.jinmdz.fmis.mapper.mapper.provider.LoungeHomeProvider;
import com.jinmdz.fmis.mapper.entity.LoungeHomeEntity;

import java.util.ArrayList;

/**
 * 休息室房间表Mapper
 * 
 * @author generator
 * @date 2020-08-23 18:11
 */
public interface LoungeHomeMapper {

    /**
     * 增加LoungeHome
     * 
     * @param entity 数据实体
     * @return
     * @author generator
     * @date 2020-08-23 18:11
     */
    @InsertProvider(type = LoungeHomeProvider.class, method = "insertLoungeHome")
    @Options(useGeneratedKeys = true, keyProperty = "entity.id", keyColumn = "id")
    void insertLoungeHome(@Param("entity") LoungeHomeEntity entity);

    /**
     * 删除LoungeHome
     * 
     * @param id 主键
     * @param modifiedUserId 修改用户外键
     * @param version 版本号
     * @return
     * @author generator
     * @date 2020-08-23 18:11
     */
    @Update(" update lounge_home set deleted = 1,modified_user_id = #{modifiedUserId},version = unix_timestamp(now()) where id = #{id} and version = #{version} and unmodified = 0 and deleted = 0 ")
    void deletedForLoungeHome(@Param("id") Integer id, @Param("modifiedUserId") Integer modifiedUserId, @Param("version") Long version);

    /**
     * 修改LoungeHome
     * 
     * @param entity 数据实体
     * @return
     * @author generator
     * @date 2020-08-23 18:11
     */
    @UpdateProvider(type = LoungeHomeProvider.class, method = "updateLoungeHome")
    void updateLoungeHome(@Param("entity") LoungeHomeEntity entity);

    /**
     * 查询LoungeHome实体
     * 
     * @param id 主键
     * @return LoungeHomeEntity
     * @author generator
     * @date 2020-08-23 18:11
     */
    @Select(" select id,deleted,home_type_code,home_code,home_name,disable_state,sort,remark,funeral_parlour_code,create_user_id,gmt_create,unmodified,modified_user_id,gmt_modified,version from lounge_home where id = #{id} and deleted = 0 limit 1 ")
    LoungeHomeEntity getLoungeHomeById(@Param("id") Integer id);

    /**
     * 查询LoungeHome列表
     * 
     * @param entity 数据实体
     * @return LoungeHomeEntity
     * @author generator
     * @date 2020-08-23 18:11
     */
    @SelectProvider(type = LoungeHomeProvider.class, method = "listLoungeHome")
    ArrayList<LoungeHomeEntity> listLoungeHome(@Param("entity") LoungeHomeEntity entity);
}